package com.example;

import lombok.Data;

import java.io.Serializable;

/*
 * 统一返回数据对象
 * */
@Data
public class Result implements Serializable {

    private static final long serialVersionUID = 1L;

    private String code; //状态码

    private String msg;  //返回消息

    private Object data;  //返回数据

    public Result(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success(Object data) {
        return new Result("200", "上传成功", data);
    }

    public static Result error(Object data) {
        return new Result("500", "上传失败", data);
    }
}
